home *** CD-ROM | disk | FTP | other *** search
- /*
- File: SampleHeader.h
-
- Contains: a sample application showing how to implement a
- modeless dialog with a couple of controls.
-
- Written by: Nitin Ganatra
-
- Copyright: Copyright © 1994-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 8/9/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
-
- #ifndef __QUICKDRAW__
- #include <QuickDraw.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- #ifndef __PROCESSES__
- #include <Processes.h>
- #endif
-
- #ifndef __TEXTEDIT__
- #include <TextEdit.h>
- #endif
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef __MEMORY__
- #include <Memory.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __SCRAP__
- #include <Scrap.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- #ifndef __TEXTUTILS__
- #include <TextUtils.h>
- #endif
-
- enum {
- kMenuBarResID = 128,
- kAboutBoxDITLID = 128,
- kModelessDialogID = 200
- };
-
- enum {
- kOkayButton = 1,
- kCancelButton,
- kEditCheckItem,
- kEditTextField,
- kEditUserItem,
- kOkayUserItem
- };
-
- enum {
- kCutItem = 1,
- kCopyItem,
- kPasteItem,
- kClearItem,
- kAppleMenu = 128,
- kFileMenu,
- kEditMenu
- };
-
- enum {
- kNewItem = 1,
- kQuitItem
- };
-
- void InitApplication(void);
- void MyCreateNewWindow(void);
- void MainEventLoop(void);
- Boolean MenuCommand(long);
- void DoAboutBox(void);
- void PreEventLoop(void);
- void PostEventLoop(void);
- pascal void DrawWindowContent(short, short, GDHandle, long);
- void DrawIt(WindowPtr);
- void DoUpdate(WindowPtr);
- void AdjustMenus(void);
-
- Boolean EventFilter(EventRecord *theEvent, WindowPtr theFrontWindow);
- void CreateModelessDialog(void);
- void DoDialogEvent(EventRecord *);
- void DoDialogNullEvent(EventRecord *);
- void DoCut(DialogPtr);
- void DoCopy(DialogPtr);
- void DoPaste(DialogPtr);
- void DoClear(DialogPtr);
-
- static void HiliteAllControls(DialogPtr, short);
- static void DisableDialogControl(DialogPtr, short);
- static void SetDialogControlHilite(DialogPtr, short, Boolean);
- static ControlHandle GetCtlHandle(DialogPtr, short);
- static void InvalThisItemRect(DialogPtr, short);
- static void FakeButtonHilite(DialogPtr, short);
- static pascal void DrawButtonBorder(WindowPtr, short);
- static pascal void DimEditLine(WindowPtr, short);
-